# -*- coding: utf-8 -*-
# @Author	: brotherbaby
# @Date		: 2023/10/25 10:11
# @Last Modified by:   brotherbaby
# @Last Modified time: 2023/10/25 10:11
# Thanks for your comments!

from sqlalchemy import Column, Integer, VARCHAR

from src.consts import ModelName
from src.db_proxy.models.modelbase import ModelBase, ModifyingBehevior


class Site(ModelBase, ModifyingBehevior):
    """
    代收点
    """
    __tablename__ = ModelName.Site.value

    no = Column('no', VARCHAR(64), primary_key=True)
    name = Column('name', VARCHAR(64))
    address = Column('address', VARCHAR(256))  # 代收点地址
    contact = Column('contact', VARCHAR(64))  # 代收点联系人
    site_phone = Column('site_phone', VARCHAR(64))  # 代收点联系电话
    agent_person_id = Column('agent_person_id', Integer, index=True)    # 代理人id
    district = Column('district', VARCHAR(256), index=True)  # 代收点所属区/县
    remark = Column('remark', VARCHAR(256))

    def get_fields(self):
        return {
            "no": self.no,
            "name": self.name,
            "address": self.address,
            "contact": self.contact,
            "site_phone": self.site_phone,
            "agent_person_id": self.agent_person_id,
            "district": self.district,
            "remark": self.remark
        }
